package com.example.mydemo.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
import lombok.experimental.Accessors;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

@TableName("c_clock")
@Data // 若未使用lombok插件，请自行生成getter、setter以及toString方法
@AllArgsConstructor // 若未使用lombok插件，请自行生成有参构造方法
@NoArgsConstructor // 若未使用lombok插件，请自行生成无参构造方法
@Accessors(chain = true) // 开启链
public class Clock {
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    private Long employeeId;
    private Long clockType;
    private Long clockStatus;
    private LocalDateTime clockTime;
    private String location;
    private String remark;
    private Long isDelete;
    private String createBy;
    private LocalDateTime createTime;
    private String updateBy;
    private LocalDateTime updateTime;





    public Clock(Long id, Long empId, int type, int status, String time, String location, String remark) {

        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
        this.id =id;
        this.employeeId =empId;
        this.clockType = (long) type;
        this.clockStatus = (long) status;
        this.clockTime = LocalDateTime.parse(time,formatter);
        this.location =location;
        this.remark =remark;
        this.isDelete = 0L;          // isdelete=0（未删除）
        this.updateBy =String.valueOf(empId);  // update_by=员工ID
        this.updateTime =LocalDateTime.now();    // update_time（当前时间）
        this.createBy =String.valueOf(empId);  // create_by=员工ID
        this.createTime =LocalDateTime.now();     // create_time（当前时间）
    }

}

    // 使用链式编程，可以连续调用setter方法，如：
